//
// Created by xuchao on 16-11-21.
//

#ifndef OKPG_OKPGPREPAREDSTATEMENT_H
#define OKPG_OKPGPREPAREDSTATEMENT_H

#include <iostream>
#include <zconf.h>
#include <postgresql/libpq-fe.h>
#include "OkPgResultSet.h"

namespace OKPg {

    struct ParamDef{
        char v[65];
    };
    class OkPgPreparedStatement {
    public:
        int paramCount_;
        std::string stmtName_;
        std::string paramValues_[100];
        int paramLengths_[100];
        int paramFormats_[100];
        ParamDef param[100];
    private:
        static int stmt_;

    public:
        OkPgPreparedStatement(const int paramCount);

        virtual ~OkPgPreparedStatement();

    public:
        std::string getStmt() const;

        void setInt(const int paramIndex, const int value);

        void setString(const int paramIndex, const std::string &value);

        void setDouble(const int paramIndex, const double value);

        void setLongLong(const int paramIndex, const long long value);

        void setTimestamp(const int paramIndex, const time_t &value);

    };

}


#endif //OKPG_OKPGPREPAREDSTATEMENT_H
